
'''客户端会请求服务器来认证并确认连接'''

from socket import socket, AF_INET, SOCK_STREAM
import ssl
s = socket(AF_INET, SOCK_STREAM)
s_ssl = ssl.wrap_socket(s,
                cert_reqs=ssl.CERT_REQUIRED,
                ca_certs = 'server_cert.pem')
s_ssl.connect(('localhost', 20001))
s_ssl.send(b'Hello World?')

resp = s_ssl.recv(8192)
print(f"{resp = }")

#s_ssl.send(b'')
s_ssl.close()